//
//  ViewController.m
//  12-4 book
//
//  Created by mac on 15-12-4.
//  Copyright (c) 2015年 1. All rights reserved.
//

#import "ViewController.h"
#import "fucking_book.h"
@interface ViewController ()
{
    NSMutableArray *bookName;
}
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.title =@"书架";
    
    bookName =@[
                @"《诛仙》",
                @"《飘渺之旅》",
                @"《紫》"
                ].mutableCopy;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return bookName.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell * cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
    cell.textLabel.text = bookName[indexPath.row];
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    fucking_book * con = [fucking_book new];
    con.text = @"天地不仁，以万物为刍狗";
    con.title = bookName[indexPath.row];
    [self.navigationController pushViewController:con animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
